Skip to content

feat(e2e): re-submit each country's contract details in the browser - #1479

Merged
gabrielseco merged 5 commits into
feat/schema-canaryfrom
feat/schema-canary-browser
Oct 8, 2026
Merged

gabrielseco merged 5 commits into
feat/schema-canaryfrom
feat/schema-canary-browser

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

For every EOR country, CI now opens a real sandbox employment in the example app, goes through the onboarding steps up to contract details, and submits again. It fails if the form blocks Continue, the save is rejected, or the browser sends different contract details than were saved.

Why

  • feat(e2e): add contract details schema canary script #1382 checks the schema, the SDK's form logic and the backend in Node. It never renders the flow. This PR covers what a partner's user actually sees: saved values loaded back into the form, every field rendering, browser validation, and the flow's own submit.
  • Dragon's EOR smoke test does a similar thing (save via API, open, Continue, expect 200). This one runs every live country instead of a hand-kept list, and also compares the request body, which a 200 alone misses.
  • It already found something: on resume, GBR's contract details are blocked with "Required field" because overtime_eligible isn't returned after save. That's the Tiger bug in partner-facing terms.

What changed

Toggle details

Per country (example/e2e/canary/contract-details.spec.ts, own config example/playwright.canary.config.ts, excluded from the regular e2e run):

  1. The canary seeds and submits as before. With --keep-submitted=<file> it keeps the employments whose submit passed and writes country, employment, company and the sent payload.
  2. The spec opens ?demo=onboarding-basic&employmentId=…, continues through select country, basic information and engagement agreement where a country has it.
  3. Contract details must render fields. Continue must send PATCH /v1/employments/{id}. It must return 2xx, its contract_details must equal what the canary sent, and the next step must show.
  4. npm run schema-canary:archive -- --from=<file> archives everything, in an always() step.

Exceptions, both explicit:

  • ack_non_eligible_job_titles isn't persisted, so the spec ticks it again on resume. That's the only checkbox it touches.
  • KNOWN_UNSAVED_FIELDS entries (GBR overtime_eligible) must come back empty, which asserts the bug is still there, and are answered again from the sent value. Once Tiger fixes it, the spec fails and says to remove the entry.

Which countries run:

  • Nightly: every country.
  • PRs: npm run schema-canary:affected diffs against the base branch.
    • When only per-country entries changed (a pinned version in jsonSchemaVersions.ts, a seed, a known-unsaved entry), it runs just those countries.
    • Docs and other files the canary doesn't read are ignored.
    • Anything else the canary reads (form code, the spec, example/src/flows/Onboarding/**, the basic-information version) runs every country.
    • This PR touches the canary itself, so it runs all of them.
  • example/src/flows/Onboarding/** now triggers the PR canary: constants.ts sets features and jsfModify (including the custom daily_schedule component), which change how contract details render.

CI: the browser stage lives in a composite action, .github/actions/schema-canary-browser, used by both jobs. It builds the library, installs Chromium, starts the example app against sandbox with the canary's secrets (same company as the seeded employments), runs the spec with 4 workers, and uploads the Playwright report. A browser failure on the nightly also opens or updates the schema-canary issue.

Look closely at: the step conditions in schema-canary.yml (archiving must always run), and the PR job timeout (30 min).

No public API changes.

Screenshots

N/A

Related Resources

Testing

  • Tested against the example/ app in a browser: DEU, ESP, FRA and GBR pass locally against sandbox.

  • Feature flag: N/A

  • All 92 countries seed, submit and archive with --keep-submitted locally.

  • Unit tests: scripts/schema-canary/affected-countries.test.ts, updated submit-contract-details.test.ts.

  • schema-canary:affected on a fake CHN bump plus a README edit returns CHN only.

  • The full 92-country browser run is this PR's CI job.

🤖 Generated with Claude Code


Note

Medium Risk
Extends CI with sandbox-authenticated browser tests and changes headless submit/rebuild logic that the canary relies on; secrets only run in CI, not production app code.

Overview
Adds a browser stage to the contract-details schema canary: after Node seeds and submits against sandbox, successful employments are written via --keep-submitted and Playwright walks the example onboarding flow to re-submit contract details, asserting the PATCH body matches what the canary saved.

CI gains a composite action (build, Chromium, start example app on sandbox, run playwright.canary.config.ts, upload reports). Nightly and PR jobs run the browser step when kept employments exist, archive in always(), and treat browser failures like canary failures for issues. PR runs use schema-canary:affected to limit countries (or skip when none), add concurrency, and widen path triggers to example/src/flows/Onboarding/**.

Canary scripts: multi-country --country, record sent on successful submit, optional keep instead of immediate archive, schema-canary:archive and affected-country detection with tests. submit-contract-details iterates rebuild passes so conditional defaults match the UI; seeding returns companyId; archive retries.

Example app: token helpers are cached until expiry; regular Playwright ignores **/canary/**.

Reviewed by Cursor Bugbot for commit dd1981c. Bugbot is set up for automated code reviews on this repo. Configure here.

The schema canary proves the schema, the SDK form logic and the backend
agree, but not that the rendered Onboarding flow does. For each country
whose submit check passed, the browser stage now opens the employment in
the example app, continues through basic information, renders contract
details from the saved values, and re-submits it. It fails when the
PATCH is rejected, when Continue is blocked, or when the body differs
from what the canary sent.

- schema-canary --keep-submitted=<file> keeps those employments and
  writes country, employment, company and the sent payload to <file>;
  schema-canary:archive archives them afterwards.
- --country takes a comma-separated list.
- ack_non_eligible_job_titles is not persisted, so the spec ticks it
  again on resume. KNOWN_UNSAVED_FIELDS entries (GBR overtime_eligible)
  must come back empty and are answered again from the sent value.
- On PRs, schema-canary:affected runs only the countries whose pinned
  version, seed or known-unsaved entry changed, and every country when
  anything else the canary reads changed. Nightly runs every country.
- example/src/flows/Onboarding/** now triggers the PR canary: its
  features and jsfModify change how contract details render.

Verified locally: DEU, ESP, FRA and GBR pass in the browser; all 92
countries seed, submit and archive with --keep-submitted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 228.91 kB 228.91 kB 0 B (0%) 🟢
Total (raw) 637.74 kB 637.74 kB 0 B (0%) 🟢
CSS (gzip) 21.94 kB 21.94 kB 0 B (0%) 🟢
CSS (raw) 114.43 kB 114.43 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 228.91 kB / 350 kB (65.4%)
  • ✅ Total raw: 637.74 kB / 850 kB (75.0%)
  • ✅ CSS gzipped: 21.94 kB / 25 kB (87.8%)

Largest Files (Top 5)

  1. index.esm-wIkXrqU6.js - 11.4 kB (0 B (0%))
  2. styles.css - 10.97 kB (0 B (0%))
  3. index.css - 10.97 kB (0 B (0%))
  4. internals-Bfee4wlS.js - 6.12 kB (0 B (0%))
  5. hooks-B1CnEL_O.js - 5.84 kB (0 B (0%))
View All Files (291 total)
File Size (gzip) Change
index.esm-wIkXrqU6.js 11.4 kB 0 B (0%)
styles.css 10.97 kB 0 B (0%)
index.css 10.97 kB 0 B (0%)
internals-Bfee4wlS.js 6.12 kB 0 B (0%)
hooks-B1CnEL_O.js 5.84 kB 0 B (0%)
sdk.gen-FtLNfTcH.js 5.54 kB 0 B (0%)
index.js 5.51 kB 0 B (0%)
flows/Onboarding/hooks.js 4.52 kB 0 B (0%)
utils-CUgvJHl4.js 4.07 kB 0 B (0%)
FieldSetField-CDERaaih.js 4.03 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-es8oiwmpj-remotecom.vercel.app
Latest Commit:dd1981c

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-7gpcdrpa7-remotecom.vercel.app
Latest Commit:dd1981c

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 89.33% 89.33% 0% ⚪
Statements 88.88% 88.88% 0% ⚪
Functions 88.09% 88.09% 0% ⚪
Branches 80.38% 80.38% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 5256 / 5884
  • Coverage: 89.33%
  • Change: 0% (0 lines)
Statements Coverage
  • Covered: 5354 / 6024
  • Coverage: 88.88%
  • Change: 0% (0 statements)
Functions Coverage
  • Covered: 1405 / 1595
  • Coverage: 88.09%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3253 / 4047
  • Coverage: 80.38%
  • Change: 0% (0 branches)

✅ Coverage check passed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c9b34ee. Configure here.

Comment thread scripts/schema-canary.ts Resolved
Comment thread .github/workflows/schema-canary.yml Resolved
gabrielseco and others added 4 commits October 8, 2026 16:08
The first CI run was blocked by the sandbox CloudFront firewall (403
"too much traffic"), which failed the proxy, left Select Country empty
and stopped archiving, leaking employments.

- The example app's proxy fetched a new OAuth token for every proxied
  request. It now caches each token until a minute before it expires.
- archiveEmployment retries four times with backoff, so a temporary
  block can't leak employments.
- The browser stage runs 3 workers on CI instead of 4.

The browser stage also caught the canary drifting from the real form:
on rebuild, a default that a condition turns on (ECU forces
work_hours_per_week to 40 for full time) was only read from the first
build, so the canary never sent it while the form did. The canary now
re-reads defaults from the rebuilt fields until they stop changing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The kept file was only written at the end of the run, so a timeout or
cancel during the canary left kept employments off disk and the
always() archive step had nothing to clean up. It's now rewritten after
every kept country.

Also run the PR canary, and every country, when the affected-countries
script changes, and pin upload-artifact's comment to its exact tag.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…anary runs

The html and github reporters print nothing until the end, so the
browser stage looked stuck. A newer push now cancels the older PR run
instead of running both against sandbox at once; the always() archive
step still cleans up the cancelled run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… job

Reuses ci-main's key (runner OS + Playwright version) so the canary
shares the cached Chromium, and retries the system-dependency and
browser installs instead of failing the run on one apt or download
hiccup.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@gabrielseco
gabrielseco merged commit 49def7a into feat/schema-canary Oct 8, 2026
18 checks passed
@gabrielseco
gabrielseco deleted the feat/schema-canary-browser branch October 8, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants